package cn.iocoder.yudao.module.scrm.controller.admin.customer.vo;

import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.scrm.annotations.DictField;
import cn.iocoder.yudao.module.scrm.controller.admin.commom.vo.FileInfoVO;
import cn.iocoder.yudao.module.scrm.enums.DictTypeConstants;
import cn.iocoder.yudao.module.scrm.framework.operatelog.core.*;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mzt.logapi.starter.annotation.DiffLogField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static cn.iocoder.yudao.module.scrm.enums.DictTypeConstants.*;

@Schema(description = "管理后台 - SCRM客户 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CustomerRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8519")
    //@ExcelProperty("主键")
    private Long id;

    @Schema(description = "客户名称", example = "李四")
    @ExcelProperty("客户名称")
    private String name;

    @Schema(description = "企业")
    @ExcelProperty("企业")
    private String enterprise;

    @Schema(description = "电话")
    @ExcelProperty("电话")
    private String phone;

    @Schema(description = "线索来源")
    @ExcelProperty("线索来源")
    private String clueSource;

    @Schema(description = "获客时间")
    @ExcelProperty("获客时间")
    private LocalDateTime customerSourceTime;

    @Schema(description = "客户来源")
    @ExcelProperty(value = "客户来源" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_CLUE_CLIENT)
    @DictFormat(SCRM_CLUE_CLIENT)
    private String customerSource;

    private String customerSourceLabel;

    @Schema(description = "素材来源")
    @ExcelProperty("素材来源")
    private String materialSource;

    @Schema(description = "信息来源")
    @ExcelProperty(value = "信息来源", converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_CLUE_INFO)
    @DictFormat(SCRM_CLUE_INFO)
    private String infoSource;

    private String infoSourceLabel;

    @Schema(description = "客户质量-》客户意向")
    @ExcelProperty(value = "客户意向", converter = DictConvert.class)
    @DictFormat(SCRM_CLUE_IDEA)
    @DictField(dictType = DictTypeConstants.SCRM_CLUE_IDEA)
    private String clientQuality;

    private String clientQualityLabel;

    @Schema(description = "备注", example = "随便")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "扩展")
    //@ExcelProperty("扩展")
    private String extend;

    @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    //@ExcelProperty("跟进状态")
    private Boolean followUpStatus;

    @Schema(description = "最后跟进时间")
    @ExcelProperty("最后跟进时间")
    private LocalDateTime contactLastTime;

    @Schema(description = "最后跟进内容")
    @ExcelProperty("最后跟进内容")
    private String contactLastContent;

    @Schema(description = "下次联系时间")
    @ExcelProperty("下次联系时间")
    private LocalDateTime contactNextTime;

    @Schema(description = "负责人的用户编号", example = "15447")
    //@ExcelProperty("负责人的用户编号")
    private Long ownerUserId;

    @Schema(description = "负责人名字", example = "25682")
    @ExcelProperty("负责人名字")
    private String ownerUserName;

    @Schema(description = "负责人部门")
    @ExcelProperty("负责人部门")
    private String ownerUserDeptName;

    @Schema(description = "成为负责人的时间")
    //@ExcelProperty("成为负责人的时间")
    private LocalDateTime ownerTime;

    @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    //@ExcelProperty("成交状态")
    private Boolean dealStatus;

    @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    //@ExcelProperty("锁定状态")
    private Boolean lockStatus;

    @Schema(description = "客户等级，对应字典 SCRM_CUSTOMER_LEVEL")
    //@ExcelProperty("客户等级")
    private Integer level;

    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    //@ExcelProperty("状态")
    private Integer status;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
    //@ExcelProperty("创建人")
    private String creator;

    @Schema(description = "创建人名字", example = "芋道源码")
    @ExcelProperty("创建人名字")
    private String creatorName;

    @Schema(description = "协助人")
    //@ExcelProperty("协助人")
    private List<AdminUserRespDTO> assistants;







    @Schema(description = "客户阶段", example = "新客户 1")
    @ExcelProperty(value = "客户阶段" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_CUSTOMER_STAGE)
    @DictFormat(SCRM_CUSTOMER_STAGE)
    private String customerStage;
    private String customerStageLabel;



    @Schema(description = "年营业额", example = "A(1000亿以上) 1")
    @ExcelProperty(value = "年营业额" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_YEAR_TURNOVER)
    @DictFormat(SCRM_YEAR_TURNOVER)
    private String yearTurnover;
    private String yearTurnoverLabel;

    @Schema(description = "分公司", example = "分公司 中创")
    @ExcelProperty(value = "分公司" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_SON_COMPANY)
    @DictFormat(SCRM_SON_COMPANY)
    private String sonCompany;
    private String sonCompanyLabel;


    @Schema(description = "回款方式,关联枚举CrmReceivableReturnTypeEnum", example = "1")
    @ExcelProperty(value = "回款方式" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_PAYMENT_METHOD)
    @DictFormat(SCRM_PAYMENT_METHOD)
    private String receivableMethod;
    private String receivableMethodLabel;

    @Schema(description = "峰会是否签到,使用字典咯", example = "1")
    @ExcelProperty(value = "峰会是否签到" , converter = DictConvert.class)
    @DictField(dictType = DictTypeConstants.SCRM_SUMMIT_STATUS)
    @DictFormat(SCRM_SUMMIT_STATUS)
    private String summitStatus;
    private String summitStatusLabel;
    

    @Schema(description = "职位", example = "职位")
    @ExcelProperty("职位")
    private String position;

    @Schema(description = "身份证号", example = "身份证号")
    @ExcelProperty("身份证号")
    private String idCard;

    @Schema(description = "邀约人", example = "邀约人")
    @ExcelProperty("邀约人")
    private String inviter;

    @Schema(description = "回款金额", example = "6.66")
    @ExcelProperty("回款金额")
    private BigDecimal receivablePrice;

    @Schema(description = "回款时间", example = "2020-02-02 02:02:02")
    @ExcelProperty("回款时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT)
    private LocalDate receivableTime;



    @Schema(description = "峰会组别", example = "峰会组别")
    @ExcelProperty("峰会组别")
    private String summitGroup;

    @Schema(description = "员工人数", example = "员工人数")
    @ExcelProperty("员工人数")
    private String numberPeople;

    @Schema(description = "需求及痛点", example = "需求及痛点")
    @ExcelProperty("需求及痛点")
    private String quantityPain;

    @Schema(description = "图片-附件信息", example = "https://www.iocoder.cn")
    private List<FileInfoVO> pictureAttachment;

    @Schema(description = "附件信息", example = "https://www.iocoder.cn")
    private List<FileInfoVO> attachment;

}